<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <canvas id="canvas">aaaaa

  </canvas>
  <script>
    var myCanvas = document.querySelector('#canvas')
    console.dir(myCanvas)
    //
    myCanvas.width = '500'
    myCanvas.height = '500'
    var ctx = myCanvas.getContext('2d')
    ctx.beginPath();
    ctx.moveTo(250, 50)
    ctx.lineTo(100, 150)
    ctx.lineTo(400, 150)
    ctx.fillStyle = 'red'
    ctx.fill()
    ctx.closePath()
    ctx.strokeStyle = 'pink'
    ctx.lineWidth = '3'
    ctx.stroke()
  </script>
</body>


</html>